from classfile.constant_info import ConstantInfo


class ConstantClassInfo(ConstantInfo):
    def __init__(self, cp):
        super().__init__()
        self.cp = cp
        self.nameIndex = 0

    def readInfo(self, clsReader):
        self.nameIndex = int.from_bytes(clsReader.readU16(), "big")

    def name(self):
        return self.cp.getU8(self.nameIndex)
